<div class="coreBlocks form">
<?php echo $this->Form->create('CoreBlock'); ?>
	<fieldset>
		<legend><?php echo __('Add Core Block'); ?></legend>
	<?php
		echo $this->Form->input('core_sites_id');
		echo $this->Form->input('cobl_name', array('type'=>'select', 'options'=>$blocksArray,'onchange' => "javascript:loadBlockForm($(this));"));
		echo $this->Form->input('cobl_description');
		echo $this->Form->input('cobl_position', array('options'=>array('t'=>__('Top'), 'l'=>__('Left'), 'c'=>__('Center'), 'r'=>__('Right'), 'b'=>__('Bottom'))));
		echo $this->Form->input('cobl_sequence', array('type'=>'number'));
		echo $this->Form->input('cobl_template', array('type'=>'select', 'options' => $layouts, 'empty' => true));
		//echo $this->Form->input('cobl_attributes');
		echo $this->Form->input('cobl_status', array('options' => array('a' => __('Active'), 'i' => __('Inactive')), 'default' => 'a'));
                echo $this->CoreForm->checkboxSelectAll('CoreModule.como_id', array(
                    'label'=>__('Modules'),
                    'type' => 'select',
                    'multiple' => 'checkbox',
                    'options' => $modules
                ));
                echo $this->CoreForm->checkboxSelectAll('CoreGroupsBlock.core_groups_id', array(
                    'label'=>__('Groups'),
                    'type' => 'select',
                    'multiple' => 'checkbox',
                    'options' => $groups
                ));
	?>
                <label for="block_form"><?php echo __('Block Form'); ?></label><div id="block_form"></div>
	</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>

		<li><?php echo $this->Html->link(__('List Core Blocks'), array('action' => 'index')); ?></li>
		<li><?php echo $this->Html->link(__('List Core Sites'), array('controller' => 'core_sites', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Core Sites'), array('controller' => 'core_sites', 'action' => 'add')); ?> </li>
	</ul>
</div>
<script>
    function loadBlockForm(input){
        $('#block_form').html('<?php echo __('Loading...'); ?>');
        url = input.find(":selected").val();
        var pices = url.split('/');
        $('#block_form').load('../'+pices[0]+'/form_'+pices[1]); 
    }
</script>
